import React from 'react';
import { format } from '@/utils/datetime';
import CommonPage from '@/components/page/CommonPage';
import { renderNumber } from '@/utils/common';
const daoName = 'ShIndiLlcsdr';
const importName = 'ShIndiLlcsdr';
const columns: API.Column[] = [
  {
    title: '生效日期',
    width: 120,
    sorter: true,
    key: 'SXRQ',
    dataIndex: 'SXRQ',
    render: (data) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '担保方式',
    width: 120,
    sorter: true,
    dataIndex: 'DBFS',
    key: 'DBFS',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '金额',
    width: 120,
    sorter: true,
    dataIndex: 'JE',
    key: 'JE',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '期限',
    width: 120,
    sorter: true,
    dataIndex: 'QX',
    key: 'QX',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '利率(%)',
    width: 100,
    sorter: true,
    render: (data) => renderNumber('.2f', data),
    key: 'LL',
    dataIndex: 'LL',
    dispaly: true,
    filter: true,
    export: true,
    align: 'right',
  },
];
const controls: API.Control[] = [
  { name: 'DBFS', type: 'text', label: '担保方式', grid: 12 / 24 },
  { name: 'JE', type: 'text', label: '金额', grid: 12 / 24 },
  { name: 'QX', type: 'text', label: '期限', grid: 12 / 24 },
  { name: 'LL', type: 'number', label: '利率', grid: 12 / 24 },
  {
    name: 'SXRQ',
    rules: [{ required: true, message: '不能为空' }],
    type: 'date',
    dataType: 'date',
    label: '生效日期',
    grid: 12 / 24,
  },
];
const ShIndiLlcsdrForm: React.FC = () => {
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      title="利率参数"
      importName={importName}
      importControls={controls}
      importMode="DeleteAfterInsert"
      importParamNames={['SXRQ']}
      importTemplateName="利率参数导入"
      initSorter={{ FieldName: 'SXRQ', Direction: 'DESC' }}
    />
  );
};

export default ShIndiLlcsdrForm;
